<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>添加派出所</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <style>
        #LAY_layedit_1{ height: 200px!important;}
    </style>
</head>

<body>
<div style="margin: 15px;">

    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">派出所名称</label>
            <div class="layui-input-block">
                <input type="text" name="title" lay-verify="police" autocomplete="off" placeholder="请输入派出所名称" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">所在地</label>
                <div class="layui-input-inline" style="width: 160px;">
                    <select name="interest" lay-filter="">
                        <option value=""></option>
                        <option value="0">陕西省</option>
                        <option value="1" selected="">安徽省</option>
                    </select>
                </div>
                <div class="layui-input-inline"  style="width: 160px;">
                    <select name="interest" lay-filter="">
                        <option value=""></option>
                        <option value="0">西安市</option>
                        <option value="1" selected="">安康市</option>
                        <option value="2">商洛市</option>
                        <option value="3">咸阳市</option>
                        <option value="4">宝鸡市</option>
                    </select>
                </div>
                <div class="layui-input-inline"  style="width: 160px;">
                    <select name="interest" lay-filter="">
                        <option value=""></option>
                        <option value="0">雁塔分局</option>
                        <option value="1" selected="">碑林分局</option>
                        <option value="2">莲湖分局</option>
                        <option value="3">咸阳市</option>
                        <option value="4">宝鸡市</option>
                    </select>
                </div>

            </div>

        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">详细地址</label>
            <div class="layui-input-block">
                <input type="text" name="title" lay-verify="address" autocomplete="off" placeholder="请输入详细地址" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系电话</label>
            <div class="layui-input-block">
                <input type="tel" name="title" lay-verify="tel" autocomplete="off" placeholder="请输入联系电话" class="layui-input">
            </div>
        </div>


        <div class="layui-form-item" style="margin-top: 30px;">
            <div class="layui-input-block">
                <div style="float: right;">
                    <button class="layui-btn" lay-submit="" lay-filter="branch">确定</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>

            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="plugins/layui/layui.js"></script>
<script>
    layui.use(['form'], function() {
        var form = layui.form(),
                layer = layui.layer;

        //自定义验证规则
        form.verify({
            police: function(value) {
                if(value.length < 4) {
                    return '标题至少得4个字符啊';
                }
            },
            pass: [/(.+){6,12}$/, '密码必须6到12位'],
            content: function(value) {
                layedit.sync(editIndex);
            }
        });

        //监听提交
        form.on('submit(branch)', function(data) {
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            return false;
        });
    });
</script>
</body>

</html>